package com.wn.pettyloan.service.impl;

import com.wn.pettyloan.entity.Contract;
import com.wn.pettyloan.entity.ContractTemplate;
import com.wn.pettyloan.mapper.ContractMapper;
import com.wn.pettyloan.mapper.ContractTemplateMapper;
import com.wn.pettyloan.mapper.DebitMapper;
import com.wn.pettyloan.service.ContractService;
import com.wn.pettyloan.vo.HistogramVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * @program: pettyloan
 * @ClassName ContractServiceImpl
 * @description:
 * @author: 国雨浓
 * @create: 2022-12-08 14:11
 **/
@Service
public class ContractServiceImpl implements ContractService {
    @Resource
    private ContractMapper contractMapper;
    @Resource
    private ContractTemplateMapper contractTemMapper;
    @Resource
    private DebitMapper debitMapper;

    @Override
    public List<HistogramVo> histogram() {
        return contractMapper.histogram();
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return contractMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(Contract record) {
        return contractMapper.insertSelective(record);
    }

    @Override
    public Contract selectByPrimaryKey(Long id) {
        return contractMapper.selectByPrimaryKey(id);
    }


    @Override
    public int updateByPrimaryKeySelective(Contract record) {
        return contractMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<Contract> selectAll() {
        return contractMapper.selectAll();
    }
    @Override
    public ContractTemplate getNewContractByUserId(Integer userId, Integer status) {
        return contractTemMapper.getContractTempByUserId(userId,status);
    }

    @Override
    public int insertAndGetPK(Contract contract) {
        return contractMapper.insert(contract);
    }
}